<template>
  <div class="app-container">
    <el-card style="border-radius: 10px">
      <el-form
        :model="queryParams"
        ref="queryForm"
        size="small"
        :inline="true"
        v-show="showSearch"
        label-width="100px"
      >
        <el-form-item label="外协订单号" prop="workorderCode">
          <el-input
            v-model="queryParams.workorderCode"
            placeholder="请输入外协订单编号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>

        <el-form-item label="报工人" prop="nickName">
          <el-input
            v-model="queryParams.nickName"
            placeholder="请输入报工人名称"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
<!--        <el-form-item label="审核人" prop="recordNick">
          <el-input
            v-model="queryParams.recordNick"
            placeholder="请输入审核人"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="状态" prop="status">
          <el-select
            v-model="queryParams.status"
            placeholder="请选择状态"
            clearable
          >
            <el-option
              v-for="dict in dict.type.mes_order_status"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>-->
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-search"
            size="mini"
            @click="handleQuery"
          >搜索
          </el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置
          </el-button>
        </el-form-item>
      </el-form>
    </el-card>
    <div style="height: 15px"></div>
    <el-card style="border-radius: 10px">
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button
            type="primary"
            icon="el-icon-plus"
            size="mini"
            @click="handleAdd"
            v-hasPermi="['pro:outsourcefeedback:add']"
          >新增
          </el-button>
        </el-col>
        <right-toolbar
          :showSearch.sync="showSearch"
          @queryTable="getList"
        ></right-toolbar>
      </el-row>
      <el-table border
        v-loading="loading"
        :data="feedbackList"
        @selection-change="handleSelectionChange"
      >
        <el-table-column
          label="报工编号"
          width="200px"
          align="center"
          prop="feedbackCode"
          :show-overflow-tooltip="true" >
          <template slot-scope="scope">
            <el-button
              type="text"
              @click="handleView(scope.row)"
              v-hasPermi="['pro:outsourcefeedback:query']"
            >{{scope.row.feedbackCode}}</el-button>
          </template>

        </el-table-column>
        <el-table-column
          label="外协订单编号"
          width="200px"
          align="center"
          prop="workorderCode"
          :show-overflow-tooltip="true" />
        <el-table-column label="生产商编码" align="center" prop="attr1"/>
        <el-table-column label="生产商名称" align="center" prop="attr2"/>
        <el-table-column label="报工人" align="center" prop="nickName"/>
        <el-table-column label="报工时间" align="center" prop="feedbackTime"/>
        <el-table-column label="报工状态" align="center" prop="status">
          <template v-slot="scope">
            <el-tag type="primary" v-show="scope.row.status=='PREPARE'" dffect="dark">草稿
            </el-tag>
            <el-tag type="success" v-show="scope.row.status=='FINISHED'" dffect="dark">审批通过</el-tag>
            <el-tag type="warning" v-show="scope.row.status=='APPROVING'" dffect="dark">待审批</el-tag>
            <el-tag type="danger" v-show="scope.row.status=='REJECTED'" dffect="dark">已驳回</el-tag>
          </template>
        </el-table-column>
        <el-table-column
          label="操作"
          align="center"
          width="270px"
        >
          <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row)"
                v-hasPermi="['pro:outsourcefeedback:edit']"
                v-if="scope.row.status === 'PREPARE'&&scope.row.c==null"
              >编辑</el-button>
              <el-button
                size="mini"
                icon="el-icon-upload2"
                type="text"
                @click="handleSubmit(scope.row)"
                v-hasPermi="['pro:outsourcefeedback:submit']"
                v-if="scope.row.status === 'PREPARE'"
              >提交</el-button>
              <el-button
                size="mini"
                type="text"
                icon="el-icon-s-check"
                @click="handleUpdate(scope.row)"
                v-hasPermi="['pro:outsourcefeedback:approve']"
                v-if="scope.row.status === 'APPROVING'"
              >审批</el-button>
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDelete(scope.row)"
                v-hasPermi="['pro:outsourcefeedback:remove']"
                v-if="scope.row.status == 'PREPARE'&&scope.row.c==null"
              >删除</el-button>
          </template>
        </el-table-column>
      </el-table>

      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </el-card>
    <!-- 添加或修改工序外协报工记录对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px"  :disabled="optType=='view'||optType=='submit'">
        <el-row>

          <el-col :span="24">
            <el-form-item label="工序外协订单" prop="workorderCode">
              <el-input
                v-model="form.workorderCode"
                placeholder="请选择外协订单"readonly
              >
                <el-button
                  slot="append"
                  icon="el-icon-search"
                  @click="handleOrderSelect"
                  :disabled="optType!='save'&&optType!='edit'"
                ></el-button>
              </el-input>
            </el-form-item>
            <OrderSelector
              ref="woSelect"
              :workorderCode="this.form.workorderCode"
              @onSelected="onOrderSelected">
            </OrderSelector>

          </el-col>

        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="报工人" prop="nickName">
              <el-input v-model="form.nickName" readonly placeholder="请选择报工人">
                <el-button
                  slot="append"
                  @click="handleNickNameSelect"
                  icon="el-icon-search"
                  :disabled="optType=='view'"
                ></el-button>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="报工时间" prop="feedbackTime">
              <el-date-picker
                clearable
                v-model="form.feedbackTime"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择报工时间"
                :disabled="form.status==='PREPARE'?false:true"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="审核人" prop="recordNick">
              <el-input v-model="form.recordNick" placeholder="请选择审核人">
                <el-button
                  slot="append"
                  @click="handleUser2Select"
                  icon="el-icon-search"
                ></el-button>
              </el-input>
            </el-form-item>
            <UserSingleSelect
              ref="user2Select"
              @onSelected="onUser2Selected"
            ></UserSingleSelect>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="备注" prop="remark">
              <el-input
                v-model="form.remark"
                type="textarea"
                placeholder="请输入内容"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-divider content-position="center">外协工序信息</el-divider>
        <el-table border v-loading="loading" :data="this.form.feedbackLine" >
          <el-table-column label="产品编号" align="center" prop="productCode"width="150" >
          </el-table-column>
          <el-table-column label="产品名称" align="center" prop="productName" width="150"/>
          <el-table-column label="规格型号" align="center" prop="specification" width="100"/>
          <el-table-column label="单位" align="center" prop="unitOfMeasure" width="100"/>
          <el-table-column
            v-for="col in columnsConfig"
            :key="col.prop"
            :label="col.label"
            :prop="col.prop"
            :width="col.width"
            :align="col.align"
            v-if="col.show">
          </el-table-column>
          <el-table-column  label="工序编号" align="center" prop="processCode" width="150"/>
          <el-table-column label="工序名称" align="center" prop="processName" width="150"/>
          <el-table-column label="是否质检" align="center" prop="needCheck" >
            <template slot-scope="scope">
              <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.needCheck"/>
            </template>
          </el-table-column>
          <el-table-column label="需求数量" align="center" prop="productQuantity" fixed="right" width="80">
          </el-table-column>
          <el-table-column label="报工数量" align="center" prop="quantityFeedback" fixed="right" width="150">
            <template slot-scope="scope">
              <el-input-number
                :min="0.01"
                size="mini"
                :step="0.01"
                :precision="2"
                v-model="scope.row.quantityFeedback"
                v-if="(optType == 'save' || optType == 'edit')"
                @blur="getTotalPrice2(scope.row)"
                @change="getTotalPrice2(scope.row)"
              >
              </el-input-number>
              <span    v-if="(optType != 'save' && optType != 'edit')">{{scope.row.quantityFeedback}}</span>
            </template>
          </el-table-column>
          <el-table-column label="单价" align="center"prop="price" fixed="right" width="150">
            <template slot-scope="scope">
              <el-input-number
                :min="0.01"
                size="mini"
                :step="0.01"
                :precision="2"
                v-model="scope.row.price"
                v-if="(optType == 'save' || optType == 'edit')"
                @blur="getTotalPrice2(scope.row)"
                @change="getTotalPrice2(scope.row)"
              >
              </el-input-number>
              <span    v-if="(optType != 'save' && optType != 'edit')">{{scope.row.price}}</span>
            </template>
          </el-table-column>
          <el-table-column label="总价" align="center" prop="totalPrice" width="80" fixed="right">
            <template slot-scope="scope">
              {{scope.row.totalPrice}}
            </template>
          </el-table-column>
          <el-table-column label="检验单名称" align="center"  width="150" >
            <template slot-scope="scope">
              <span v-if="scope.row.qcOsqc!=null">{{ scope.row.qcOsqc.osqcName }}</span>
            </template>
          </el-table-column>
          <el-table-column label="检验单编号" align="center"    prop="qcOsqc.osqcCode" width="150" >
            <template slot-scope="scope">
              <span v-if="scope.row.qcOsqc!=null">{{ scope.row.qcOsqc.osqcCode }}</span>
            </template>
          </el-table-column>
          <!--          <el-table-column label="检验日期" align="center" prop="inspectDate" width="150" />
                    <el-table-column label="检验人" align="center" prop="inspector" width="150" />-->
          <el-table-column label="检测数量"    align="center" prop="" width="80" >
            <template slot-scope="scope">
              <span v-if="scope.row.qcOsqc!=null">{{ scope.row.qcOsqc.quantityCheck}}</span>
            </template>
          </el-table-column>
          <el-table-column label="合格数量"    align="center" prop="" width="80" >
            <template slot-scope="scope">
              <span v-if="scope.row.qcOsqc!=null">{{ scope.row.qcOsqc.quantityCheck-scope.row.qcOsqc.quantityUnqualified }}</span>
            </template>
          </el-table-column>
          <el-table-column label="不合格数量" align="center" prop="qcOsqc.quantityUnqualified" width="150" >
            <template slot-scope="scope">
              <span v-if="scope.row.qcOsqc!=null">{{ scope.row.qcOsqc.quantityUnqualified }}</span>
            </template>
          </el-table-column>
          <el-table-column label="合格率" align="center" prop="" width="80" >
            <template slot-scope="scope">
              <span v-if="scope.row.qcOsqc!=null&&scope.row.qcOsqc.quantityCheck==0">--</span>
              <span v-if="scope.row.qcOsqc!=null&&scope.row.qcOsqc.quantityCheck!=0">{{ (((scope.row.qcOsqc.quantityCheck-scope.row.qcOsqc.quantityUnqualified) / (scope.row.qcOsqc.quantityCheck )) * 100).toFixed(2) }}%</span>
            </template>
          </el-table-column>
          <el-table-column label="检测结果" align="center"  prop="" width="150" >
            <template slot-scope="scope">
              <dict-tag :options="dict.type.mes_qc_result" :value="scope.row.checkResult"/>
            </template>

          </el-table-column>
          <el-table-column
            fixed="right"
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
            v-if="optType == 'save' || optType == 'edit' || optType == 'select'">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                v-if="(optType == 'save' || optType == 'edit')"
                @click="handleDeleteLine(scope.row)"
              >删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button
          type="primary"
          @click="cancel"
          v-if="optType == 'view' || form.status != 'PREPARE'"
        >返 回</el-button>
        <el-button
          type="primary"
          @click="submitForm"
          v-if="form.status == 'PREPARE' && optType != 'view'"
        >保 存
        </el-button>

        <el-button
          type="success"
          @click="handleExecute"
          v-hasPermi="['pro:outsourcefeedback:approve']"
          v-if="canApprove&& optType == 'submit'"
        >审批通过
        </el-button>
        <el-button
          type="danger"
          @click="handleReject"
          v-hasPermi="['pro:outsourcefeedback:approve']"
          v-if="canApprove&& optType == 'submit'"
        >审批不通过
        </el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <feedback-info v-if="infoOpen" ref="feedbackInfo"></feedback-info>
  </div>
</template>

<script>
import { addOutsourcefeedback, delOutsourcefeedback, approve, getOutsourcefeedbackInfo, listOutsourcefeedback, updateOutsourcefeedback,submitOutsourcefeedback } from "@/api/mes/pro/outsourcefeedback";
import WorkorderSelect from "@/components/workorderSelect/single.vue";
import WorkstationSelect from "@/components/workstationSelect/simpletableSingle.vue";
import UserSingleSelect from "@/components/userSelect/single.vue";
import ProtaskSelect from "@/components/TaskSelect/taskSelectSingle.vue";
import FeedbackInfo from "@/components/Feedback/feedbackInfo.vue";
import IpqcSelect from "@/components/ipqcSelect/single.vue";
import ProTask from "@/views/mes/pro/workticket/task/proTask.vue";
import OutsourceissueSelect from "@/components/OutsourceissueSelect/single.vue";
import Defectrecord from "@/components/defectrecordSelect/index.vue";
import OrderSelector from "@/views/mes/pro/outsourcingorder/orderSelector.vue";
import Template from "@/views/print/printtemplate/list.vue";
import SelectManufacture from "@/views/mes/md/outsourcedmanufacture/selectManufacture.vue";
import {executeOrder} from "@/api/mes/pro/outsourcingorder";
import {getColumnsConfigKey} from "@/api/system/columnsconfig";
export default {
  name: "Outsourcefeedback",
  components: {
    SelectManufacture,
    Template,
    OrderSelector,
    Defectrecord,

    OutsourceissueSelect,
    ProTask,
    IpqcSelect,
    WorkorderSelect,
    WorkstationSelect,
    UserSingleSelect,
    ProtaskSelect,
    FeedbackInfo,
  },
  dicts: ["mes_order_status", "mes_feedback_type", "pro_pricing_method",'mes_index_type','sys_yes_no','mes_qc_result'],
  data() {
    return {
      columnsConfig:[],
      canApprove:false,
      defect_qclineid:null,
      defect_qctype:null,
      isBao:false,
      userId:null,
      userName:null,
      nickName:null,
      quantity:0,
      productList:[],
      optType: undefined,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 工序外协报工记录表格数据
      feedbackList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,

      infoOpen: false,

      taskStatus: 'PROGRESS',


      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        feedbackType: null,
        workstationId: null,
        workstationCode: null,
        workstationName: null,
        workorderId: null,
        workorderCode: null,
        workorderName: null,
        taskId: null,
        taskCode: null,
        itemId: null,
        itemCode: null,
        itemName: null,
        unitOfMeasure: null,
        specification: null,
        quantity: null,
        quantityFeedback: null,
        quantityQualified: null,
        quantityUnquanlified: null,
        userName: null,
        nickName: null,
        feedbackChannel: null,
        feedbackTime: null,
        recordUser: null,
        recordNick: null,
        status: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        feedbackType: [
          { required: true, message: "报工类型不能为空", trigger: "change" },
        ],

        price: [
          { required: true, message: "单价不能为空", trigger: "blur" },
        ],
        workorderCode: [
          { required: true, message: "外协订单不能为空", trigger: "blur" },
        ],
        nickName: [
          { required: true, message: "请选择报工人", trigger: "blur" },
        ],
        feedbackTime: [
          { required: true, message: "请选择报工时间", trigger: "blur" },
        ],
        quantityUncheck:[
          { required: true, message: "待检数量不能为空", trigger: "blur" },
        ],
      },
    };
  },
  created() {
    this.getList();
    this.getItemBase();
  },
  methods: {
    getItemBase(){
      getColumnsConfigKey('MdItem_Base').then(res=>{
        this.columnsConfig = JSON.parse(res.data);
      })
    },
    handleDeleteLine(row){
      this.form.feedbackList=this.form.feedbackList.filter(obj => obj.id != row.id);
      this.elTableKey = this.elTableKey+1
    },
    //缺陷记录
    handleDefect(row){
      this.defect_qcid = row.osqcId;
      this.defect_qclineid = row.lineId;
      this.$nextTick(() => {
        this.$refs.defectDialog.showFlag = true;
        this.$refs.defectDialog.getList();
      })
    },
    /** 查询工序外协报工记录列表 */
    getList() {
      this.loading = true;
      listOutsourcefeedback(this.queryParams).then((response) => {
        this.feedbackList = response.rows;
        this.nickName=response.attachment.nickName;
        this.userName=response.attachment.userName;
        this.userId=response.attachment.userId;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {

        recordId: null,
        feedbackType: null,
        workstationId: null,
        workstationCode: null,
        workstationName: null,
        routeId: null,
        routeCode: null,
        processId: null,
        processCode: null,
        processName: null,
        workorderId: null,
        workorderCode: null,
        workorderName: null,
        taskId: null,
        taskCode: null,
        taskName: null,
        itemId: null,
        itemCode: null,
        itemName: null,
        specification: null,
        quantity: 0,
        price:0.01,
        quantityUncheck: 0.01,
        quantityFeedback: 0.01,
        quantityQualified: 0,
        quantityUnquanlified: 0,
        attr3:this.userId,
        userName: this.userName,
        nickName: this.nickName,
        feedbackChannel: null,
        feedbackTime: new Date(),
        recordUser: null,
        recordNick: null,
        status: "PREPARE",
        remark: null,
        attr1: null,
        attr2: null,
        attr4: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        workingHours: 1,
        feedbackLine:[]
      };
      this.canApprove=false;
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.recordId);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加工序外协报工记录";
      this.optType = "save";
    },
    handleSubmit(row){
        const that = this;
      this.$modal.confirm('是否确认提交报工审核？提交后将不能修改信息！').then(function () {
          submitOutsourcefeedback({recordId:row.recordId,status:"APPROVING"}).then((response) => {
            that.$modal.msgSuccess("提交成功");
            that.open = false;
            that.getList();
          }).catch(() => {

          });
      });
    },
    getTotalPrice2(row){

      if(row.price!=null&&row.price!=''&&row.quantityFeedback!=null&&row.quantityFeedback!=''){
        row.totalPrice = Math.round(row.quantityFeedback*row.price*100)/100
      }
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const recordId = row.recordId || this.ids;
        getOutsourcefeedbackInfo(recordId).then(response => {
          this.form = response.data.proFeedback;
          this.open = true;
          if (row.status == 'APPROVING') {
            this.title = "审核工序外协报工记录";
            this.optType = "submit";
            this.canApprove=response.data.canApprove;
          }else{
            this.title = "修改工序外协报工记录";
            this.optType = "edit";
          }
        });
    },
    // 查询明细按钮操作
    handleView(row) {
      this.reset();
      const recordId = row.recordId || this.ids;
   /*   getOutsourcefeedback(recordId).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "查看工序外协报工单信息";
        this.optType = "view";
      });*/
      getOutsourcefeedbackInfo(recordId).then(response => {
        this.form = response.data.proFeedback;
        this.open = true;
        this.title = "查看工序外协报订单信息";
        this.optType = "view";
      });
    },
    // 查询明细按钮操作
    handleInfoView(row) {
      const recordId = row.recordId || this.ids;
      this.infoOpen = true;
      this.$nextTick(() => {
        this.$refs.feedbackInfo.init(recordId);
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.feedbackLine.length > 0 && !this.form.feedbackLine.find(line => {
            return line.quantityFeedback == null || line.quantityFeedback == ''
          })) {
            if (this.form.recordId != null) {
              updateOutsourcefeedback(this.form).then((response) => {
                this.$modal.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              });
            } else {
              addOutsourcefeedback(this.form).then((response) => {
                this.$modal.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              });
            }
          }else{
            this.$modal.msgError("外协工序信息及报工产品数量不能为空");
          }
        }
      });
    },

    //审批通过执行
    handleExecute() {
      const data = this.form;
      const that=this;
      this.$modal
        .confirm("是否确认报工审核完成？审核后不可更改！")
        .then(function () {
          approve(that.form.recordId, "FINISHED").then((response) => {
            that.$modal.msgSuccess("提交成功");
            that.open = false;
            that.getList();
          });
        })

    },
    //审批不通过，拒绝
    handleReject() {
      if (this.form.recordId != null) {
        approve(this.form.recordId, "REJECTED").then((response) => {
          this.$modal.msgSuccess("提交成功");
          this.open = false;
          this.getList();
        });
      }
    },
    /** 删除按钮操作 */
    handleDelete(row) {

      this.$modal
        .confirm('是否确认删除此数据项？')
        .then(function () {
          return delOutsourcefeedback(row.recordId);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "pro/feedback/export",
        {
          ...this.queryParams,
        },
        `feedback_${new Date().getTime()}.xlsx`
      );
    },
    //选择外协订单
    handleOrderSelect() {
      this.$refs.woSelect.showFlag = true;
    },
    onOrderSelected(row) {
      if (row != undefined && row != null) {
        this.form.workorderId = row.orderId;
        this.form.workorderCode = row.orderCode;
        this.form.workorderName = row.orderName;
        if(row.orderLineList.length>0) {
          row.orderLineList.forEach(line=> {
            line.orderlineId = line.id
            line.quantityFeedback = line.productQuantity;
          })
          this.form.feedbackLine  = row.orderLineList;
        }
      }
    },

    //点击人员选择按钮
    handleUser2Select() {
      this.isBao=false;
      this.$refs.user2Select.showFlag = true;
    },
    handleNickNameSelect(){
      this.isBao=true;
      this.$refs.user2Select.showFlag = true;
    },
    //人员选择返回
    onUser2Selected(row) {
      if(this.isBao){
        this.form.attr3=row.userId;
        this.form.nickName = row.nickName;
        this.form.userName = row.userName;
      }else {
        this.form.recordUser = row.userName;
        this.form.recordNick = row.nickName;
      }
    },
  },
};
</script>
<style scoped>
.production-info {
  border: 1px solid #ddd;
  padding: 16px;
  border-radius: 4px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.details {
  flex-grow: 1;
  margin-left: 16px;
}

.status {
  margin-left: 16px;
}

.status-text {
  color: orange;
  border: 1px solid orange;
  padding: 4px 8px;
  border-radius: 4px;
}

.content {
  margin-top: 16px;
}
</style>
